package com.yrot.admin.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yrot.admin.dto.BindUser;
import com.yrot.admin.entity.SysQuestions;
import com.yrot.admin.entity.SysResult;
import com.yrot.admin.entity.SysTrain;
import com.yrot.admin.service.*;
import com.yrot.common.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.validation.Valid;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hemin
 * @since 2019-04-02
 */
@RestController
@RequestMapping("/mp/question")
public class MpQuestionController {
    @Autowired
    ISysQuestionsService questionsService;
    @Autowired
    IEveryDaySetService everyDaySetService;
    @Autowired
    ISysTrainService trainService;
    /**
     * 获取所有题
     */
    @GetMapping("/getSpecialQuestion")
    public R getSpecialQuestion(){
        List<SysQuestions> list = questionsService.list(null);
        return R.ok(list);
    }
    /**
     * 查询自我测评设置
     * @return 自我测评设置信息
     */
    @GetMapping("/getSpecialSet")
    public R getSpecialSet(){
        return R.ok(everyDaySetService.getById(2));
    }
    /**
     * 查询考试安排
     * @return 考试安排
     */
    @GetMapping("/getExamPlan")
    public R getExamPlan(){
        QueryWrapper<SysTrain> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByAsc("train_start");
        queryWrapper.eq("is_send",0);
        return R.ok(trainService.list(queryWrapper));
    }
}
